package com.bw.redis.consumer;

import com.ruoyi.common.redis.service.RedisService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "group1",topic = "xxx")
public class RcoketConsumer implements RocketMQListener {
    @Autowired
    private RedisService redisService;
    @Override
    public void onMessage(Object o) {
        if(!o.toString().equals("延时消息")){
            if(redisService.hasKey("cdict"+o.toString())){
                redisService.deleteObject("cdict"+o.toString());
            }
            return;
        }
        if(redisService.hasKey("dictionaryList")){
            redisService.deleteObject("dictionaryList");
        }
    }
}
